package com.itheima.mapper;

import com.itheima.VO.ConfigAllVO;
import com.itheima.VO.ConfigVO;
import com.itheima.entity.SysConfig;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface ConfigMapper {

    @Select("select * from sys_config")
    List<SysConfig> getList();


    @Select("select attr_key,attr_value from sys_config")
    List<Map<String, String>> getAttrValue();


    @Select("select validator from sys_config where validator != ''")
    String getSiteName();


    @Select("select distinct group_value from sys_config where tab_value = #{x}")
    List<String> getGroupValueByTabValue(String x);


    @Select("select * from sys_config where group_value = #{name}")
    List<SysConfig> getByGroupValue(String name);

    void insertConfig(ConfigVO configVO);

    @Select("select * from sys_config where tab_value = #{tabValue}")
    List<SysConfig> selectByName(String tabValue);


    ConfigAllVO selectAllConfig();
}
